bitkeeper revision 1.1159.1.32 (4118d35c609YWhxt_3C-hWCNhXozxA)
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Tue, 10 Aug 2004 13:53:32 +0000 (13:53 +0000)
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Tue, 10 Aug 2004 13:53:32 +0000 (13:53 +0000)
migration integration with new xend

tools/libxc/xc_linux_restore.c
tools/python/xen/xend/XendDomain.py
tools/python/xen/xend/XendDomainInfo.py

index db21621e55c15eb06962f795762d321e61b1e314..304413b485a012311657698f26a19c4a2e20af1b 100644 (file)
@@ -86,7 +86,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
     int rc = 1, i, n, k;
     unsigned long mfn, pfn, xpfn;
     unsigned int prev_pc, this_pc;
-    u32 dom = ioctxt->domain;
+    u32 dom = 0;
     int verify = 0; 
 
     /* Number of page frames in use by this Linux session. */
@@ -143,7 +143,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
         return 1;
     }
 
-    /* Start writing out the saved-domain record. */
+    /* Start reading the saved-domain record. */
     if ( xcio_read(ioctxt, signature, 16) ||
          (memcmp(signature, "LinuxGuestRecord", 16) != 0) )
     {
@@ -201,6 +201,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
         goto out;
     }
 
+#if 0
     /* Set the domain's name to that from the restore file */
     if ( xc_domain_setname( xc_handle, dom, name ) )
     {
@@ -218,6 +219,21 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
                   dom, nr_pfns,nr_pfns * (PAGE_SIZE / 1024));
         goto out;
     }
+#endif
+
+
+    /* XXX create domain on CPU=-1 so that in future it auto load ballances by default */
+    if ( xc_domain_create( xc_handle,  nr_pfns * (PAGE_SIZE / 1024),
+                          name,
+                          -1, &dom ) )
+    {
+       xcio_error(ioctxt, "Could not create domain. pfns=%d, %dKB",
+                  nr_pfns,nr_pfns * (PAGE_SIZE / 1024));
+        goto out;
+    }
+    
+    ioctxt->domain = dom;
+    printf("Created domain %ld\n",dom);
 
     /* Get the domain's shared-info frame. */
     op.cmd = DOM0_GETDOMAININFO;
index 7ae079734ff11b8bed29e6217be7779d5b1dc0a9..826d24a4fa538c410371ce1646c31e27db2a2baf 100644 (file)
@@ -413,7 +413,7 @@ class XendDomain:
 
     def domain_exists(self, name):
         name = str(name)
-        return self.domain_by_name.get(name) or self.domain_by_id.get(name):
+        return self.domain_by_name.get(name) or self.domain_by_id.get(name)
 
     def domain_unpause(self, id):
         """Unpause domain execution.
index 056a171fc27099c364349de552499f38b375bd7d..19f95856cb1bf2ec8f4aaaec95866f500ca591a1 100644 (file)
@@ -473,7 +473,7 @@ class XendDomainInfo:
         # When creating or rebooting, a domain with my name should not exist.
         # When restoring, a domain with my name will exist, but it should have
         # my domain id.
-        if dominfo and (not self.dom or dominfo.dom != self.dom)
+        if dominfo and (not self.dom or dominfo.dom != self.dom):
             raise VmError('vm name clash: ' + name)
         
     def construct(self, config):